<template>
  <button id="counter" @click="increment">
    {{ count }}
  </button>
</template>

<script setup>
import { ref, nextTick } from "vue"

const count = ref(0)

async function increment() {
  count.value++

  /**
   * DOM还未更新,如何确保DOM已经更新 ?
   * 请保证以下输出为true
  */
  // nextTick(() => {
  //   console.log(+document.getElementById("counter").textContent === 1)
  // })

  await nextTick()
  console.log(+document.getElementById("counter").textContent === 1)

}
</script>